# include<stdio.h>
int main(int argc, char const *argv[])
{
    int n,max=0,min=1000,temp;
    scanf("%d",&n);
    while (n--)
    {
        scanf("%d",&temp);
        max = max>temp? max:temp;
        min = min<temp? min:temp;
    }
    
    printf("%d",max-min);

    return 0;
}
